#define _CRT_SECURE_NO_WARNINGS 1

#include <stdio.h>


int nfactorial(int n)
{
	if (n == 1)
	{
		return 1;
	}
	else
	{
		return n * nfactorial(n - 1);
	}
}


int main()
{
	int n;
	int a = 1;
	scanf("%d", &n);
	printf("%d\n", nfactorial(n));
	while (n)
	{
		a *= n;
		--n;
	}
	printf("%d\n",a);

	return 0;
}